<template>
	<view style="display: flex;justify-content: center;align-items: center;">
		<view>{{msg}}</view>
	</view>
</template>

<script>
	import sqliteUtil from "@/utils/sqliteUtil.js"
	import modal from "@/utils/modal.js"

	export default {
		data() {
			return {
				msg: "系统初始化..."
			}
		},
		mounted() {
			// this.iniDb()
		},
		onShow() {
			console.log("home显示");
			// iniDb()
		},
		methods: {
			iniDb() { //初始化打开数据库
				if (sqliteUtil.isOpen()) {
					this.goIndex()
				} else {
					sqliteUtil.openSqlite()
						.then(res => {
							this.goIndex()
						})
						.catch(err => {
							msg = err.message || err
						})
				}
			},
			goIndex() {
				setTimeout(() => {
					uni.navigateTo({
						url: '/pages/index/index'
					});
				}, 500)
			}
		}
	}
</script>

<style>

</style>